<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&#32;</xsl:text>
</xsl:template>
<xsl:template match='quote' name='quote'>
<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>
</xsl:template>
<xsl:template match='crlf' name='crlf'>
<xsl:text disable-output-escaping='yes'>&#10;</xsl:text>
</xsl:template>



<xsl:template match="Registration">

<!-- Insert appropriate Validation -->
<script>
function validateForm() {
	document.returnValue = true;
	if ( (document.getElementById("T3").value) == '' ) {
		alert("Devi mettere un oggetto al tuo messaggio !");
		document.returnValue = false;
	}else{
	  if ( (document.getElementById("TA4").value) == '' ) {
  		alert("Devi mettere un contenuto nel messaggio!");
  		document.returnValue = false;
  	}
  }
}
</script>

<!-- End of Insert appropriate Validation -->


<table class="gbox" border="0" cellspacing="8" cellpadding="0" width="100%">
<form name="formRegistration" method="post" action="{@action}" onSubmit="validateForm();return document.returnValue">
<tr>
<input type="hidden" name="FORM_ID" value="FORM5"></input>
<input type="hidden" name="staff" value="{/Registration/@staff}"></input>
<td colspan="4">
</td>
</tr>


<xsl:for-each select="Question">
	<xsl:choose>
		<xsl:when test='@Type="17"'>
		</xsl:when>
		<xsl:when test='@Type="8"'>
			<tr><td colspan="4" align="center">
			<input type="hidden" name="receiverGuid" value="{/Registration/@receiverGuid}"></input>
			<br/><input type="submit" name="{concat('SUBMIT',@ID)}" value="{@Description}" ></input><br/>
			</td></tr>
		</xsl:when>
		<xsl:when test='@Type="5" and @ID="1"'>
			<tr height="30px">
				<td valign="top"><xsl:value-of select="@Description"/></td>
				<td colspan="2" ></td>
				<td align="left" valign="top"><input value="{/Registration/@senderNick}" type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}" readonly="true"></input>
				<br/>
				<span class="body_10px_red"><b>Sender IP address:
				<xsl:value-of select="/Registration/@senderIP"/>
				</b></span><br/>

				</td>
			</tr>
		</xsl:when>

		<xsl:otherwise>
			<tr>
			<td>
			<xsl:value-of select="@Description"/>
			</td><td align="right">
			</td><td>

			</td>
			<td>



			<xsl:if test='@Type="1"'>
				<select class="body" size="1" name="D{@ID}">
					<xsl:for-each select="Answer">
						<option value="{@ID}"><xsl:value-of select="."/></option>
					</xsl:for-each>
				</select>
			</xsl:if>


			<xsl:if test='@Type="5"'>
				<xsl:choose>
					<xsl:when test='@ID="3" and /Registration/@subject!=""'><input value="{/Registration/@subject}" type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}"></input></xsl:when>
					<xsl:when test='@ID="3" and ((floor( /Registration/@settings div 16 ) mod 2) and /Registration/@isBuddy = "False") and not (/Registration/@authlevel &gt; 0)'><input value="Mi vuoi tra i tuoi amichetti?" type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}" readonly="true"></input></xsl:when>
					<xsl:when test='@ID="3"'><input type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}"></input></xsl:when>
					<xsl:otherwise><input type="text" name="{concat('T',@ID)}" size="{@P2}" maxlength="{@P1}"></input></xsl:otherwise>
				</xsl:choose>

				<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
			</xsl:if>

			<xsl:if test='@Type="11"'>
				<input type="text" ID="T{@ID}" name="NICK{@ID}" size="{@P2}" maxlength="{@P1}"></input>
				<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
			</xsl:if>

			<xsl:if test='@Type="12"'>
				<input type="password" ID="T{@ID}" name="PW{@ID}" size="{@P2}" maxlength="{@P1}"></input>
				<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
			</xsl:if>

			<xsl:if test='@Type="13"'>
				<TEXTAREA id="TA{@ID}" name="TA{@ID}" rows="{@P1}" WRAP="SOFT" style="width:100%;"></TEXTAREA>
				<br/><span class="body_10px_red"><xsl:value-of select="@Comment"/></span>
			</xsl:if>

			</td>
			</tr>
		</xsl:otherwise>
	</xsl:choose>

</xsl:for-each>

</form>
</table>
</xsl:template>

</xsl:stylesheet>